package pub.tbc.config;

import lombok.extern.slf4j.Slf4j;
import pub.tbc.config.cache.ConfigCache;
import pub.tbc.config.remote.RemoteConfigServiceByZookeeper;
import pub.tbc.config.service.RemoteConfigService;

import java.util.Map;

/**
 * @author tbc on 2017/8/18 10:22:08.
 */
@Slf4j
public class ConfigInitializer {
    public static void initialize() {
        //
        RemoteConfigService remoteConfigService = new RemoteConfigServiceByZookeeper();
        Map<String, String> list = remoteConfigService.getConfigList();
        // 设置本地缓存
        log.info("flush cache ...");
        ConfigCache.instance().flush(list);
        // 注册监听

    }
}
